package cn.iocoder.yudao.module.of.controller.admin.taskinfo.vo;

import cn.iocoder.yudao.module.of.controller.admin.taskhandler.vo.TaskHandlerSaveReqVO;
import cn.iocoder.yudao.module.of.controller.admin.taskinfo.dto.DocumentDTO;
import cn.iocoder.yudao.module.of.controller.admin.taskinfo.dto.MeetingDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 任务模块新增 Request VO")
@Data
public class TaskInfoAddReqVO {

    @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @NotEmpty(message = "任务名称不能为空")
    private String taskName;

    @Schema(description = "任务描述")
    private String taskDesc;

    @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "任务编号不能为空")
    private String taskCode;

    @Schema(description = "任务来源: 1中心来文、2会议、3领导交办、4其它", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "任务来源不能为空")
    private Integer taskFrom;

    @Schema(description = "任务来源扩展：其它or会议 用得到")
    private String taskFromExt;

    @Schema(description = "任务级别:1主任务、2从任务", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "任务级别不能为空")
    private Integer taskLevel;

    @Schema(description = "任务类型:1全年、2常规", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "任务类型不能为空")
    private Integer taskType;


    @Schema(description = "开始时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime startTime;

    @Schema(description = "结束时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime endTime;

    @Schema(description = "父级任务", example = "8621")
    private Long parentId;

    @Schema(description = "公文信息")
    private DocumentDTO taskDocument;

    @Schema(description = "会议信息")
    private MeetingDTO taskMeeting;

    @Schema(description = "附件")
    private List<Long> taskAttachment;

    @Schema(description = "公文附件")
    private List<Long> taskDocFile;

    @Schema(description = "状态：0草稿、1待审批、2审批通过、3审批不通过,4跟进中、5挂起、99结束", example = "2")
    private Integer status;

    /**
     * 任务办理人
     */
    @NotEmpty(message = "任务办理人不能为空")
    List<TaskHandlerSaveReqVO> taskHandlerList;

    @Schema(description = "子任务")
    List<TaskInfoAddReqVO> children;

}